package com.eco.fanliapp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.dao.KillPointsCommissionMapper;
import com.eco.fanliapp.entity.KillPointsCommission;
import com.eco.fanliapp.service.IKillPointsCommissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class KillPointsCommissionServiceImpl extends ServiceImpl<KillPointsCommissionMapper, KillPointsCommission> implements IKillPointsCommissionService {

    @Autowired
    private KillPointsCommissionMapper killPointsCommissionMapper ;


    /**
     *  新写入数据库记录,kill_points_commission
     *
     * @param killPointsCommission
     */
    @Override
    public ServerResponse insertKillRipeScheme(KillPointsCommission killPointsCommission) {
        int insert = killPointsCommissionMapper.insert(killPointsCommission);
        if (insert == 1){
            return ServerResponse.createBySuccessMessage("方案增加成功");
        }
        return ServerResponse.createByErrorMessage("方案增加失败");
    }

    /**
     *  根据主键来更新符合条件的数据库记录,kill_points_commission
     *
     * @param killPointsCommission
     */
    @Override
    public ServerResponse updateByPrimaryKey(KillPointsCommission killPointsCommission) {
        int update = killPointsCommissionMapper.updateByPrimaryKey(killPointsCommission);
        if (update == 1){
            return ServerResponse.createBySuccessMessage("方案修改成功");
        }
        return ServerResponse.createByErrorMessage("方案修改失败");
    }
}
